package org.power.bus.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;

@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("predictfeature")
@ApiModel(value = "Feature对象", description = "特征表")
@ToString
public class PredictFeature implements Serializable {
    private static final long serialVersionUID = 1L;

    @TableId(value = "feature_id", type = IdType.AUTO)
    @ApiModelProperty(value = "特征ID")
    private Integer featureId;

    @TableField(value = "check_time")
    @ApiModelProperty(value = "检测时间")
    private String checkTime;

    @TableField(value = "equipment_name")
    @ApiModelProperty(value = "设备名称")
    private String equipmentName;

    @TableField(value = "equipment_temperature")
    @ApiModelProperty(value = "设备温度")
    private String equipmentTemperature;

    @TableField(value = "interval_unit")
    @ApiModelProperty(value = "间隔单元")
    private String intervalUnit;

    @TableField(value = "phase")
    @ApiModelProperty(value = "相别：A、B、C")
    private String phase;

    @TableField(value = "env_temperature")
    @ApiModelProperty(value = "环境温度")
    private String envTemperature;

    @TableField(value = "humidity")
    @ApiModelProperty(value = "环境湿度")
    private String humidity;

    @TableField(value = "wind_speed")
    @ApiModelProperty(value = "风速")
    private String windSpeed;

    @TableField(value = "wind_direction")
    @ApiModelProperty(value = "风向")
    private String windDirection;

    @TableField(value = "load_current")
    @ApiModelProperty(value = "负载电流")
    private String loadCurrent;

    public boolean checkValid() {
        if (StringUtils.isNotEmpty(equipmentName)
                && StringUtils.isNotEmpty(equipmentTemperature)
                && StringUtils.isNotEmpty(intervalUnit)
                && StringUtils.isNotEmpty(phase)
                && StringUtils.isNotEmpty(envTemperature)
                && StringUtils.isNotEmpty(humidity)
                && StringUtils.isNotEmpty(windSpeed)
                && StringUtils.isNotEmpty(windDirection)
                && StringUtils.isNotEmpty(loadCurrent)) {
            return true;
        }
        return false;
    }
}
